package com.softer.wxzj.controller;


import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.aop.annotation.LogRecord;
import com.softer.wxzj.common.aop.enums.LogOperationType;
import com.softer.wxzj.common.aop.enums.LogOperationUnit;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.LogOperation;
import com.softer.wxzj.service.LogOperationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * RoleController class
 * @author zcz
 * @date 2019/1/16
 */
@RestController
@RequestMapping("/logOperation")
@Slf4j
public class LogOperationController {
    @Autowired
    LogOperationService logOperationService;

    @RequestMapping("/delete")
    @LogRecord(description = "操作日志删除",operationUnit = LogOperationUnit.LOG_OPERATION,operationType = LogOperationType.DELETE)
    public CommonResult delete(String id) {
        return logOperationService.delete(id);
    }
    @RequestMapping("/getList")
    @LogRecord(description = "查询操作日志列表",operationUnit = LogOperationUnit.LOG_OPERATION,operationType = LogOperationType.SELECT)
    public PageInfo<LogOperation> getRoleList(Page page, LogOperation logOperation) {
        return logOperationService.getList(page,logOperation);
    }
    @RequestMapping("/fuzzySearch")
    @LogRecord(description = "模糊查询操作日志列表",operationUnit = LogOperationUnit.ROLE,operationType = LogOperationType.SELECT)
    public PageInfo<LogOperation> fuzzySearch(Page page,String fuzzy) {
        return logOperationService.fuzzySearch(page,fuzzy);
    }


}
